﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace HAVTKPack
{

  public   class IsRectilinearGridChanged
    {
      public static bool IsRecGridChanged(RectilinearGrid originGrid, RectilinearGrid newGrid)
      {

          if ((originGrid == null & newGrid != null) || (originGrid != null & newGrid == null))
          {
              return true;
          }
          if (originGrid == null & newGrid == null)
          {
              return false;
          }
          if (originGrid.XLength != newGrid.XLength || originGrid.YLength != newGrid.YLength || originGrid.ZLength != newGrid.ZLength)
          {
              return true;
          }

          for (int rows = 0; rows < originGrid.YLength ; rows++)
          {
              if (originGrid .YArray [rows ]!=newGrid .YArray [rows ])
              {
                  return true;
              }
          }
          for (int cols = 0; cols < originGrid.YLength; cols++)
          {
              if (originGrid.XArray[cols] != newGrid.XArray[cols])
              {
                  return true;
              }
          }
          for (int layer = 0; layer < originGrid.YLength; layer++)
          {
              if (originGrid.ZArray[layer] != newGrid.ZArray[layer])
              {
                  return true;
              }
          }



          return false;
      }



    }


}
